import BuffUtil from '@/BuffUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 恶心之拳
 **/
export default class MSKExinzhiquan extends AbilityBase {
    static instance: MSKExinzhiquan;
    buffType: AppBuffType = {
        id: 'buff_MSKExinzhiquan',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        stackCountMax: -1,
        dur: 12,
        attribute: {
            生命恢复: -1,
            生命恢复增强: -0.05,
            move_speed: -1,
            命中: -0.01,
        },
        isDebuff: true,
    };
    constructor(id: string = 'Mnk0') {
        super(id);
        MSKExinzhiquan.instance = this;
        this.init();
        EventManager.onTakeAttack(this.onSpellEffect.bind(this));
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BuffUtil.addBuff(target, this.buffType.id);
    }
    onSpellEffect(d: DamageEventData) {
        if (GetUnitAbilityLevel(d.source, this.id) == 0) return;
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
